<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="../../static/css/style.css"/>
</head>
<body>
	<canvas></canvas>
	<div class="page">
		<div class="head"><% include components/top.inc.ejs%></div>
      
          
		<div class="content-wrap">
			<div>
				<form action="?" method="post">
					用户:<input class="input" type="text" name="username"/><br>
					标题:<br><input class="input" type="text" name="title"/><br>
					描述:<textarea class="input" name="content"></textarea><br>
					时间:<input class="input" type="text" name="time"/><br>
					阅览:<input class="input" type="text" name="view"/><br>
					链接：<input class="input" type="text" name="imgUrl"/><br>
					<input class="add" type="submit" value="添加">
				</form>
			</div>
		<table border="1" width="100%">
       	  <thead>
       	  	<tr>
       	  		<th>ID</th>
       	  		<th>用户</th>
       	  		<th>标题</th>
       	  		<th>描述</th>
				<th>时间</th>
				<th>阅览</th>
				<th>链接</th>
       	  		<th>操作</th>
       	  	</tr>
       	  </thead>
       	  <tbody>
                 <% for(var i=0;i<blogs.length;i++){ %>
       	  	<tr>
				<td><%=blogs[i].ID%></td>
				<td><%=blogs[i].username%></td>
				<td><%=blogs[i].title%></td>
				<td><%=blogs[i].content%></td>
				<td><%=blogs[i].time%></td>
				<td><%=blogs[i].view%></td>
				<td><%=blogs[i].imgUrl%></td>
       	  	     <td>
					<a href="?act=mod&id=<%=blogs[i].ID%>">修改</a>
					<a href="?act=del&id=<%=blogs[i].ID%>" onClick="return confirm('您真的离开吗')">删除</a>
				</td>
       	  	</tr>
                  <% } %>
       	  </tbody>
       </table>
        <% if(typeof  mod_data!='undefined'){ %>
        <div class="shadow"></div>
		   <div class="mod_dialog">
				<form action="?" method="post">
					<input type="hidden" name="mod_id" value="<%=mod_data.ID%>">
					用户:<input class="input" type="text" name="username" value="<%=mod_data.username%>"/><br>
					标题:<input class="input" type="text" name="title" value="<%=mod_data.title%>"><br>
					描述:<textarea class="input" name="content"><%=mod_data.content%></textarea><br>
					时间:<input class="input" type="text" name="time" value="<%=mod_data.time%>" /><br>
					阅览:<input class="input" type="text" name="view" value="<%=mod_data.view%>" /><br>
					链接:<input class="input" type="text" name="imgUrl" value="<%=mod_data.imgUrl%>" /><br>
					<input class="add" type="submit" value="修改"><br>
					<a href="/admin/blog" class="cancle">取消</a>
				</form>
		   </div>
      <% } %>
	</div>
	<script>
		document.addEventListener('touchmove', function(e) {
			e.preventDefault()
		})
		var c = document.getElementsByTagName('canvas')[0],
		    x = c.getContext('2d'),
		    pr = window.devicePixelRatio || 1,
		    w = window.innerWidth,
		    h = window.innerHeight,
		    f = 90,
		    q,
		    r = 0,
		    u = Math.PI * 2,
		    v = Math.cos,
		    z = Math.random
		
		  c.width = w * pr
		  c.height = h * pr
		  x.scale(pr, pr)
		  x.globalAlpha = 0.6
		
		  function i() {
		    x.clearRect(0, 0, w, h)
		    q = [{ x: 0, y: h * .7 + f }, { x: 0, y: h * .7 - f }]
		    while (q[1].x < w + f) d(q[0], q[1])
		  }
		
		  function d(i, j) {
		    x.beginPath()
		    x.moveTo(i.x, i.y)
		    x.lineTo(j.x, j.y)
		    var k = j.x + (z() * 2 - 0.25) * f,
		      n = y(j.y)
		    x.lineTo(k, n)
		    x.closePath()
		    r -= u / -50
		    x.fillStyle = '#' + (v(r) * 127 + 128 << 16 | v(r + u / 3) * 127 + 128 << 8 | v(r + u / 3 * 2) * 127 + 128).toString(16)
		    x.fill()
		    q[0] = q[1]
		    q[1] = { x: k, y: n }
		  }
		
		  function y(p) {
		    var t = p + (z() * 2 - 1.1) * f
		    return (t > h || t < 0) ? y(p) : t
		  }
		
		  document.onclick = i
		  document.ontouchstart = i
		  i()
	</script>
</body>
</html>